#!/usr/bin/env python

from SocketServer import (TCPServer as Tcp,StreamRequestHandler as Srh)
from time import ctime
import socket

host = ''
port = 12345
addr = (host,port)

print socket.gethostname()
print socket.gethostbyname(socket.gethostname())

class MyRequestHandler(Srh):
	def handle(self):
		print '..connect form:',self.client_address
		self.wfile.write('[%s] %s' % (ctime(),self.rfile.readline()))

server = Tcp(addr,MyRequestHandler)
print 'waiting for connection...'
server.serve_forever()
